package com.sui.bigdata.rtcadmin;

import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.MultipartConfigFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.util.unit.DataSize;

import javax.servlet.MultipartConfigElement;

/**
 * @author YongChen
 * @date 2019/11/6 14:41
 * @description
 * @email yong_chen@sui.com
 */
@SpringBootApplication(scanBasePackages = "com.sui.bigdata.rtcadmin")
@MapperScan(basePackages = "com.sui.bigdata.rtcadmin.repository.mapper")

public class RtcAdminApplication {

    public static void main(String[] args) {
        new SpringApplicationBuilder(RtcAdminApplication.class).run();
    }

    /**
     * 文件上传大小限制配置
     * @return
     */
    @Bean
    public MultipartConfigElement multipartConfigElement() {
        MultipartConfigFactory factory = new MultipartConfigFactory();
        // 单个文件数据大小
        factory.setMaxFileSize(DataSize.ofMegabytes(500));
        // 设置总上传数据总大小
        factory.setMaxRequestSize(DataSize.ofMegabytes(500));
        // 设置文件路径
        return factory.createMultipartConfig();
    }

}
